<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">

    <title>登陆</title>
    <jsp:include page="../common.jsp"></jsp:include>

    <style>
        .user-img {
            height: 100px;
            width: 100px;
            margin-bottom: 20px;
            margin-top:20px;

        }

        .shadow {
            background: url("<%=basePath%>images/header-shadow.png") 0 0 no-repeat transparent;
            width: 100px;
            height: 100px;
            z-index: 10000;
            position: absolute;
            left: 149px;
            top: 0;
        }

        .input-area {
            width: 400px;
            height: 400px;
            background-color: #FFF;
            box-shadow: 0 2px 2px #cfd6de;
            border: 1px solid #cfd6de;
            float: left;
        }
        .input-text-username,.input-text-password {
            display: inline-block;
            width: 350px;
            height: 30px;
            font-size: 17px;
            border-radius: 7px;
            border: 1px solid #C3CED9;
            background-color: #f7ecb5;
            padding-left:20px;
            padding-right: 20px;
        }
        .input-area-wrapper{
            padding-left: 20px;
            padding-right: 20px;
            position: relative;
        }

        .a-input-button,a-input-button:active .a-input-button:visited {
            display: inline-block;
            width: 350px;
            height: 30px;
            background-color: #2aabd2;
            border-radius: 5px;
            text-decoration: none;
            text-align: center;
            line-height:30px;
            font-family: '微软雅黑';
            color: #FFFFFF;
            font-size: 18px;

        }

        .register {
            background-color: #5cb85c;
        }

        .right-img {
            float: left;
            width: 600px;
            height: 400px;
            background-color: #FFF;
            box-shadow: 0 2px 2px #cfd6de;
            border: 1px solid #cfd6de;
            float: left;
        }

        .div-main-header {
            margin-top: 120px;
        }

        body{
            overflow-y: hidden;
        }

    </style>
    <script>
        $(document).ready(function(){

        })

        function submit(){
           if($(".input-text-username").val() === ''){
               $("#msg-username-empty").css("display","block");
               return;
           }
           if($(".input-text-password").val() === ''){
               $("#msg-password-empty").css("display","block");
               return;
           }
           
           if($("input[type=checkbox]").attr("checked") === true) {
               var username = $(".input-text-username").val();
               var password = $(".input-text-password").val();
               $.cookie('name',username);
               $.cookie('password', password);
           }

            $("#loginForm").submit();
        }
    </script>
</head>
<body>
<div class="div-main-header div-center" style="width: 1100px;height: 800px;">
   <div class="input-area">
       <div class="div-center input-area-wrapper">
           <div class="shadow"></div>
           <div class="user-img div-center">
                <img style="width: 100px;height: 100px" src="<%=basePath%>images/header-demo.jpg">
           </div>
           <form:form id="loginForm" modelAttribute="loginProxy">
           <div class="div-input-text ">
                <form:input path="username" type="text" class="input-text-username"/>
           </div>
           <div class="div-input-text" style="padding-top: 7px;">
               <form:password path="password" class="input-text-password"/>
           </div>
           <div style="margin-top: 5px; margin-bottom: 5px;">
               <div style="float: left">
                    <span style="color: #9d9d9d"><form:checkbox path="savePathChecked"/>记住密码</span>
               </div>
               <div style="float: right; margin-right: 10px;">
                   <a href="#" style="color:#9d9d9d;text-decoration: none;">忘记密码</a>
               </div>
           </div>
           <div id="msg-username-empty" style="clear: both;display: none">
             <span style="color: red"><strong>用户名不能为空</strong></span>
           </div>
           <div id="msg-password-empty" style="clear: both;display: none">
               <span style="color: red"><strong>密码不能为空</strong></span>
           </div>
           <div class="div-input-text" style="padding-top: 7px;">
               <a id="submit" href="#" onclick="javascript:submit();" class="a-input-button">登&nbsp录</a>
           </div>
           <div class="div-input-text" style="padding-top: 7px;">
               <a href="#" class="a-input-button register">注&nbsp册</a>
           </div>
           </form:form>
       </div>

   </div>
    <div class="right-img">
        <img src='<%=basePath + "images/loginbg.jpg" %>' style="width:600px;height:400px;position:absolute;z-index:10;">
    </div>
</div>
</body>
</html>